<template>
  <div v-loading.fullscreen.lock="fullscreenLoading">
    <el-container>
      <el-header>
        <el-row>
          <el-col :span="6">
            <a href="javascript:;">
              <img class="logo" src="../../assets/img/logo.png" alt=""
            /></a>
          </el-col>
          <el-col :span="12">
            <h2>{{ this.nickname }}管理页面</h2>
          </el-col>
          <el-col :span="6">
            <el-link
              :underline="false"
              @click="logout"
              style="margin-left: 30px; color: white; margin-bottom: 2px"
              >退出登录</el-link
            >
          </el-col>
        </el-row>
      </el-header>
      <el-container style="background-color: white">
        <el-aside width="200px">
          <el-row class="tac">
            <el-menu
              default-active="2"
              class="el-menu-vertical-demo"
              @open="handleOpen"
              @close="handleClose"
              background-color="white"
              text-color="black"
              router
            >
              <el-menu-item index="/store/ShopInfo">
                <i class="el-icon-goods"></i>
                <span slot="title">店铺商品管理</span>
              </el-menu-item>
              <el-menu-item index="/store/ShopUp">
                <i class="el-icon-sell"></i>
                <span slot="title">店铺商品上架</span>
              </el-menu-item>
              <el-menu-item index="/store/ShopOrders">
                <i class="el-icon-shopping-bag-1"></i>
                <span slot="title">店铺订单管理</span>
              </el-menu-item>
              <el-menu-item index="/store/ShopManage">
                <i class="el-icon-setting"></i>
                <span slot="title">店铺信息管理</span>
              </el-menu-item>
            </el-menu>
          </el-row>
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script>
export default {
  data() {
    return {
      nickname: sessionStorage.getItem("name"),
      fullscreenLoading: false,
    };
  },
  methods: {
    logout() {
      this.fullscreenLoading = true;
      setTimeout(() => {
        this.fullscreenLoading = false;
        this.$store.commit("outLogin");
        this.$router.push("/");
      }, 1000);
    },
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>

<style lang="scss" scoped>
.el-header {
  background-color: rgb(162, 178, 185);
  color: rgb(255, 255, 255);
  text-align: center;
  line-height: 60px;
  padding: 2px;
  .logo {
    height: 55px;
    float: left;
    position: relative;
    left: -50px;
    z-index: 1;
  }
  .el-row {
    margin-left: 117px;
  }
  .tac ul li:last-child {
    float: right;
  }
}
.el-aside {
  background-color: white;
  color: black;
  text-align: center;
  line-height: 200px;
  height: calc(100vh - 60px);
  .tac ul li {
    width: 200px;
  }
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}
a {
  text-decoration: none;
}
</style>